package tech.aistar.corejava.day06;

import java.util.Arrays;

/**
 * @author success
 * @version 1.0
 * @description:本类用来演示:
 * @date 2019/7/22 0022
 */
public class TestArrayUtil {
    public static void main(String[] args) {
        int[] arr = {1,2,3};
        int[] temp = Arrays.copyOf(arr,arr.length+1);
        System.out.println(Arrays.toString(temp));

        //java.lang.System
        //static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length);

        int[] arrs = {1,2,3};
        int[] temps = new int[arrs.length+1];
       // System.arraycopy(arrs,0,temps,0,3);

        System.arraycopy(arrs,0,temps,0,2);
        temps[2] = 8;
        System.arraycopy(arrs,2,temps,3,1);

        System.out.println(Arrays.toString(temps));
    }
}
